<template>
  <!-- 2_2项目立项-新增-选择登记项目 -->
  <div class="table-wrap">
    <div class="table-top">
      <a-input-search placeholder="请输入内容" v-model="search" class="search" @search="onSearch" />
      <a-button type="primary" class="buttonColorGreen ml10 mr10">查询</a-button>
      <a-button type="primary" class="buttonColorGreen ml10 mr10" @click="reset">重置</a-button>
    </div>
    <div class="table">
      <a-table :columns="columns" :dataSource="tableData" bordered>
        <template slot="name" slot-scope="text">
          {{text}}
        </template>
        <span slot="operation">
          <router-link to="" class="actionButton">
            <a-icon type="check-circle" />项目立项</router-link>
        </span>
        <span slot="details">
          <router-link to="projectTab">
            <a-button type="primary" class="buttonColorGreen">
              <a-icon type="zoom-in" />
              详情</a-button>
          </router-link>
        </span>
      </a-table>
    </div>
  </div>
</template>

<script>
const columns = [{   //表格表头
  title: '序号',
  dataIndex: 'number',
  scopedSlots: { customRender: 'number' },
},
{
  title: '项目名称',
  className: 'objectName',
  dataIndex: 'objectName',
},
{
  title: '项目编号',
  dataIndex: 'objectNum',
},
{
  title: '登记时间',
  dataIndex: 'checkinTime',
},
{
  title: '项目类型',
  dataIndex: 'objectType',
},
{
  title: '客户单位',
  dataIndex: 'customUnit',
},
{
  title: '  ',
  scopedSlots: { customRender: 'details' },
},
{
  title: '操作',
  // dataIndex: 'operation',
  scopedSlots: { customRender: 'operation' },
}
];

const tableData = [//表格数据
  {
    number: '1',
    objectName: '南昌县A项目',
    objectNum: '￥300,000.00',
    checkinTime: 'New York No',
    objectType: '软件型',
    customUnit: '国土局'
  },
  {
    number: '2',
    objectName: '南昌县A项目',
    objectNum: '￥1,256,000.00',
    checkinTime: 'London No',
    objectType: '软件型',
    customUnit: '国土局'
  },
  {
    number: '3',
    objectName: '南昌县A项目',
    objectNum: '￥120,000.00',
    checkinTime: 'Sidney No',
    objectType: '软件型',
    customUnit: '国土局'
  }
];

export default {
  data() {
    return {
      tableData,
      columns,
      search: ''
    }
  },
  methods: {
    onSearch() {   //搜索

    },
    onDelete(key) {  //删除
      const dataSource = [...this.dataSource]
      this.dataSource = dataSource.filter(item => item.key !== key)
    },
    reset() {  //重置
      this.search = ""
    }
  }
}
</script>

